﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Core;
using FluentNHibernate.Mapping;

namespace Tanmia.NHibernate.Mapping
{
    public class AccountMap : ClassMap<Account>
    {
        public AccountMap()
        {
            Table("Account");

            Id(x => x.AccountID).Not.Nullable().GeneratedBy.Identity();

            Map(x => x.Name).Length(128).Not.Nullable().Unique();
            Map(x => x.CreateDate).Not.Nullable().Not.Update();
            Map(x => x.Note).Length(2048).Nullable();
            Map(x => x.Number).Length(64).Not.Nullable().Unique();

            References(x => x.Parent, "ParentID");
        }
    }
}
